﻿using System;
using System.ComponentModel;

using Exif.Interfaces;
using Exif.Jpeg.Segments;
using Exif.Various;

namespace Exif.Tiff
{
	[TypeConverter(typeof(ExpandableObjectConverter))]
	public class TiffHeader
	{
		#region ctor

		public TiffHeader(IImageReader imageReader, TiffInfo parent)
		{
			Parent = parent;
			ByteOrder = (Endian)imageReader.ReadInt16();
			imageReader.PushEndian(this.ByteOrder);
			Version = imageReader.ReadUInt16();
			Offset0thIfd = imageReader.ReadUInt32();
			imageReader.PopEndian();
		}

		#endregion

		#region props

		public TiffInfo Parent { get; set; }

		public Endian ByteOrder { get; set; }

		public UInt16 Version { get; set; }

		public UInt32 Offset0thIfd { get; set; }

		public uint Length
		{
			get { return 8; }
		}

		#endregion
	}
}